/**
 * 路由器对象模块
 */

import Vue from 'vue'
import VueRouter from 'vue-router'
import MSite from '../pages/MSite/MSite.vue'
import Search from '../pages/Search/Search.vue'
import Order from '../pages/Order/Order.vue'
import Profile from '../pages/Profile/Profile.vue'
import Login from '../pages/Login/Login.vue'


//声明使用插件
Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const originalReplace = VueRouter.prototype.replace

VueRouter.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err)
}

export default new VueRouter({
    routes: [
        {
            path:'/msite',
            component:MSite,
            meta:{
                showFooter:true
            },
        }, 
        {
            path:'/search',
            component:Search,
            meta:{
                showFooter:true
            },
        }, 
        {
            path:'/order',
            component:Order,
            meta:{
                showFooter:true
            },
        }, 
        {
            path:'/profile',
            component:Profile,
            meta:{
                showFooter:true
            },
        },
        {
            path:'/login',
            component:Login,
        },
        {
            path:'/',
            redirect:'/msite'
        },
    ]
})